package com.di3fang.gateway.util;

import org.springframework.http.HttpStatus;

public enum CommonEnum {

    // 数据操作错误定义
    FAIL(-1, "fail"),
    SUCCESS(0, "success"),
    OK(200, "ok"),
    EXCEPTION(201, "接口调用异常"),
    BODY_NOT_MATCH(400, "请求的数据格式不符"),
    SIGNATURE_NOT_MATCH(401, "请求的数字签名不匹配"),
    NOT_FOUND(404, "未找到该资源"),
    NOT_ALLOWED(405, "不允许此方法"),
    NOT_ACCEPTABLE(406, "客户端解析异常"),
    INTERNAL_SERVER_ERROR(HttpStatus.INTERNAL_SERVER_ERROR.value(), "服务器内部错误"),
    SERVER_BUSY(503, "服务器正忙，请稍后再试");

    /**
     * 错误码
     */
    private Integer value;

    /**
     * 错误描述
     */
    private String msg;

    CommonEnum(Integer value, String msg) {
        this.value = value;
        this.msg = msg;
    }

    public Integer value() {
        return value;
    }

    public String msg() {
        return msg;
    }
}
